#include "wrapper_units.hpp"

namespace python
{

bp::tuple Units::GetConverter(const std::string& from,
    const std::string& to)
{
  double offset, scale;

  algorithms::Units::GetConverter(from, to, &offset, &scale);

  return bp::make_tuple(offset, scale);
}

void UnitsPythonModule()
{
  bp::class_< Units, boost::noncopyable >( "Units", bp::init< >() )
    .def("AreConvertible",
      (bool (*)
        (std::string const &, std::string const &))
          (&algorithms::Units::AreConvertible),
      (bp::arg("unit1"), bp::arg("unit2")))
    .def("GetConverter",
      (bp::tuple (*)
        (std::string const &, std::string const &))
          (Units::GetConverter),
      (bp::arg("from"), bp::arg("to")))
    .def("IsTime",
      (bool (*)
        (std::string const &))
          (algorithms::Units::IsTime),
      (bp::arg("unit")))
    .staticmethod( "AreConvertible" )
    .staticmethod( "GetConverter" )
    .staticmethod( "IsTime" );
}

} // namespace python
